package com.linko.intelligent.remote.core.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.linko.intelligent.common.util.HttpUtil;
import com.linko.intelligent.remote.core.mapper.DeviceOnlineMapper;
import com.linko.intelligent.remote.core.service.DeviceOnlineService;
import com.linko.intelligent.remote.pojo.po.DeviceOnline;
import com.linko.intelligent.remote.pojo.query.DeviceOnlineQuery;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
public class DeviceOnlineServiceImpl implements DeviceOnlineService {
    private static final org.slf4j.Logger logger = LoggerFactory.getLogger(HttpUtil.class);
    @Autowired
    private DeviceOnlineMapper deviceInfoMapper;

    @Override
    public List<DeviceOnline> deviceList(DeviceOnlineQuery query) {
        List<DeviceOnline> deviceInfos = deviceInfoMapper.selectLis(query);
        return deviceInfos;
    }

    @Override
    public PageInfo<DeviceOnline> page(DeviceOnlineQuery query) {
        PageInfo<DeviceOnline> pageInfo = PageHelper.startPage(query.getPn(), query.getPs()).doSelectPageInfo(
                () -> deviceInfoMapper.selectLis(query)
        );
        return pageInfo;
    }
}


